<template>
    <el-dialog v-bind:title="title" :visible.sync="visible">
        <el-form>
            <el-form-item v-for="(itm,idx) in itn" v-bind:label="itm.name">
                <el-input style="display:inline-block;width:33%;" v-model="itm.value"></el-input>
            </el-form-item>
        </el-form>
        <span slot="footer">
            <el-button type="primary" @click.native="this.$emit('confirmed',this.formData)">确定</el-button>
            <el-button @click.native="visible = false">取消</el-button>
        </span>
    </el-dialog>
</template>

<script>
    export default {
        name: "El_model",
        props:['title','visible','formData','tableHead'],
        //tableHead:[{colName:'profession',showName:'专业'}]
        //formData:{profession:'材料工程',school_name:'西北工业大学',collage_name:'材料学院',status:'正常'}

        data(){
            return {

            }
        },
        computed:{
            itn(){
                //itn: [{name:'专业',value:'材料工程'}]
                let result = []
                let r = {};
                for(let key in this.formData){
                    this.tableHead.forEach((item)=>{
                        if(item.inModel!==false&&item.colName === key){
                            r.name = item.showName;
                            r.id = key;
                            r.value = this.formData[key];
                            result.push(r);
                            r = {};
                        }
                    })
                }
                return result
            }
        }
    }
</script>

<style scoped>

</style>